Skip to content

Conversation

@VolodyaCO
Copy link
Collaborator

The encoder might not encode a datapoint x to a 1D spin string. In the case of autoencoders where vector quantisation layers are added, encoders might encode a datapoint x to a HxWxC array. In such a case, the default latent to discrete transformation would be wrong, as it expected only a single feature dimension, whereas in this case there are three such feature dimensions.

This PR fixes that by automatically finding the number of feature dimensions in the encoded data representation, and performs the gumbel softmax transformation accordingly, keeping the same number of feature dimensions.

@VolodyaCO VolodyaCO self-assigned this Sep 2, 2025
@VolodyaCO VolodyaCO added the enhancement New feature or request label Sep 2, 2025
Copy link
Contributor

@thisac thisac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @VolodyaCO. Don't forget to add a an entry to the release-log.

@VolodyaCO
Copy link
Collaborator Author

@thisac I don't understand very well the reno process for release notes. Is every PR intended to create a new release?

@VolodyaCO
Copy link
Collaborator Author

@thisac nvm, I just read "All of the list items in this section are combined when the release notes are rendered"

@VolodyaCO VolodyaCO force-pushed the feature/flexible-features-in-latent-to-discrete branch 2 times, most recently from 7dd9d16 to 4119f2d Compare September 7, 2025 18:47
@VolodyaCO VolodyaCO force-pushed the feature/flexible-features-in-latent-to-discrete branch from 4119f2d to a3ec9ec Compare September 19, 2025 15:37
Copy link
Collaborator

@anahitamansouri anahitamansouri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much Vlad for the nice PR. I've added a few minor comments.

@VolodyaCO VolodyaCO force-pushed the feature/flexible-features-in-latent-to-discrete branch 2 times, most recently from 673a581 to 3b81ea8 Compare September 22, 2025 19:44
Copy link
Collaborator

@kevinchern kevinchern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some very minor feedback

Comment on lines +154 to +165
@parameterized.expand(
[
(1, torch.tensor([[[1.0, 1.0]], [[1.0, -1.0]], [[-1.0, -1.0]], [[-1.0, 1.0]]])),
(
5,
torch.tensor(
[[[1.0, 1.0]] * 5, [[1.0, -1.0]] * 5, [[-1.0, -1.0]] * 5, [[-1.0, 1.0]] * 5]
),
),
]
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@parameterized.expand(
[
(1, torch.tensor([[[1.0, 1.0]], [[1.0, -1.0]], [[-1.0, -1.0]], [[-1.0, 1.0]]])),
(
5,
torch.tensor(
[[[1.0, 1.0]] * 5, [[1.0, -1.0]] * 5, [[-1.0, -1.0]] * 5, [[-1.0, 1.0]] * 5]
),
),
]
)
@parameterized.expand([
(1, torch.tensor([[[1, 1]], [[1, -1]], [[-1, -1]], [[-1, 1]]]).float()),
(5, torch.tensor([[[1, 1]]*5, [[1, -1]]*5, [[-1, -1]]*5, [[-1, 1]]*5]).float())
])

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same. I'll leave it like it is, or you can commit this suggestion later.

@VolodyaCO VolodyaCO force-pushed the feature/flexible-features-in-latent-to-discrete branch from 3b81ea8 to 425db36 Compare October 21, 2025 19:44
fix number of feature dimensions

[docs] consistent notation

release

ignore files in aim

testing different number of latent dimensions

extend tests to more feature dimensions

Update tests/test_dvae_winci2020.py

Co-authored-by: Anahita Mansouri Bigvand <[email protected]>

Update tests/test_dvae_winci2020.py

Co-authored-by: Anahita Mansouri Bigvand <[email protected]>

Update tests/test_dvae_winci2020.py

Co-authored-by: Anahita Mansouri Bigvand <[email protected]>
@VolodyaCO VolodyaCO force-pushed the feature/flexible-features-in-latent-to-discrete branch from 425db36 to 0180929 Compare October 21, 2025 19:45
@kevinchern
Copy link
Collaborator

LGTM @thisac @VolodyaCO

Copy link
Contributor

@thisac thisac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@VolodyaCO VolodyaCO merged commit f2a51c7 into dwavesystems:main Oct 21, 2025
15 checks passed
@VolodyaCO VolodyaCO deleted the feature/flexible-features-in-latent-to-discrete branch October 21, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants